package com.zmn.oms.services.impl.order;

import com.zmn.oms.model.entity.order.OrderFinalPrice;
import com.zmn.oms.persistence.interfaces.order.OrderFinalPriceDao;
import com.zmn.oms.services.interfaces.order.OrderFinalPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @ClassName FindPriceOrderExtServiceImpl
 * @description:
 * @author: wangyanci
 * @create: 2022-04-12 10:31
 * @Version 1.0
 **/
@Service
public class OrderFinalPriceServiceImpl implements OrderFinalPriceService {

    @Autowired
    private OrderFinalPriceDao orderFinalPriceDao;

    @Override
    public int insertOrderFindPrice(OrderFinalPrice orderFinalPrice) {
        if (Objects.isNull(orderFinalPrice)) {
            return 0;
        }
        return orderFinalPriceDao.insertOrderFinalPrice(orderFinalPrice);
    }

    @Override
    public OrderFinalPrice findByOrderIdAndWorkId(Long orderId, Long workId) {
        if (Objects.isNull(orderId) || Objects.isNull(workId)) {
            return null;
        }
        return orderFinalPriceDao.findByOrderIdAndWorkId(orderId, workId);
    }
}